package cn.edu.ujn;

import javax.naming.InitialContext;
import javax.naming.NamingException;

public class TestStateful {
	public static void main(String[] args) throws NamingException {
		String name="/ch19/HelloSFSB!cn.edu.ujn.IAdd";
		InitialContext context = new InitialContext();
		IAdd h1 = (IAdd) context.lookup(name);
		IAdd h2 = (IAdd) context.lookup(name);
		System.out.println("1----------addResult:"+h1.doAdd(1,2));
		System.out.println("1----------total:"+h1.getTotal());
		System.out.println("1----------addResult:"+h1.doAdd(1,2));
		System.out.println("1----------total:"+h1.getTotal());
		System.out.println("******************************");
		System.out.println("2----------addResult:"+h2.doAdd(1,2));
		System.out.println("2----------total:"+h2.getTotal());
		System.out.println("2----------addResult:"+h2.doAdd(1,2));
		System.out.println("2----------total:"+h2.getTotal());
	}

}
